﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class login : System.Web.UI.Page
{
    WebDBDataContext db = new WebDBDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonLogin_Click(object sender, EventArgs e)
    {



        Tbl_User tbuser = new Tbl_User();

        foreach (Tbl_User us in db.Tbl_Users)
        {
            if (us.Use_Name.Equals(username.Text) && us.Pas_Word.Equals(password.Text))
            {
                Session["user"] = username.Text;
                Response.Redirect("Home.aspx");

            }
            else
            {
                //Error message saying that the user name and password is incorrect
                LabelError.Text = "Invalid User Name And Password !";
            }
        }
    }
}